/**
 * <pre>
 * @(#)TestCase4.java 1.00 2009-11-25
 * 
 * Copyright (c) 1998, 2009 Regular Individual. All rights reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * Contributor(s):
 *     Haixu Huang
 * </pre>
 **/
package _test_;

import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JFrame;

import cn.sh.huang.chart.MiniChart;
import cn.sh.huang.chart.config.TitleConfig;
import cn.sh.huang.chart.ext.enumtype.Position;
import cn.sh.huang.chart.ext.enumtype.ScrollType;
import cn.sh.huang.chart.view.View;
import cn.sh.huang.chart.view.container.GridView;
import cn.sh.huang.chart.view.container.LayoutView;
import cn.sh.huang.chart.view.container.ScrollView;

/**
 * <pre>
 * TestCase4 ...
 * 
 * @version 1.0
 * </pre>
 */
public class TestCase4 implements Runnable
{

    /*
     * (non-Javadoc)
     * @see java.lang.Runnable#run()
     */
    public void run()
    {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        MiniChart chart = new MiniChart();

        GridView grid = new GridView(2, 1);

        ScrollView view = new ScrollView();
        View content = new ContentView();
        View leftBar = new VertBarView();
        view.setElement(Position.CORE, content);
        view.setElement(Position.LEFT_CENTER, leftBar);
        view.setHorizontalScrollType(ScrollType.NONE);
        grid.addView(view, 0, 0);

        view = new ScrollView();
        content = new ContentView();
        leftBar = new VertBarView();
        view.setElement(Position.CORE, content);
        view.setElement(Position.LEFT_CENTER, leftBar);
        view.setHorizontalScrollType(ScrollType.NONE);
        grid.addView(view, 1, 0);
        view = new ScrollView();
        view.setElement(Position.CORE, grid);
        view.setVerticalScrollType(ScrollType.NONE);

        LayoutView layoutView = new LayoutView();
        TitleConfig config = layoutView.getTitleConfig();
        config.setTitle("Demo Chart View 0.01");
        config.setFont(new Font("Lucida Sans", Font.PLAIN, 36));

        layoutView.setContent(view);
        chart.setView(layoutView);
        frame.getContentPane().add(chart);
        frame.pack();
        frame.setSize(new Dimension(640, 480));
        frame.setVisible(true);
    }

}
